{% extends 'layout.html' %}


{% block content %}
    {% load my_tags %}

    <div>
        <a class="btn btn-primary" href="{% reverse_url request 'add_customer' %}">添加</a>
    </div>

    <form action="" class="form-inline pull-right">
        <input type="text" name="query" class="form-control">
        <button class="btn btn-sm btn-primary">搜索</button>
    </form>

    <form action="" method="post" class="form-inline">
        {% csrf_token %}
        <select name="action" id="" class="form-control">

            {% if request.path_info == '/crm/my_customer/' %}
                <option value="multi_pub">私户变公户</option>
            {% else %}
                <option value="multi_apply">公户变私户</option>
            {% endif %}

        </select>
        <button class="btn btn-primary btn-sm">提交</button>

        <table class="table table-bordered table-hover">
            <thead>
            <tr>
                <th>选择</th>
                <th>序号</th>
                <th>QQ</th>
                <th>姓名</th>
                <th>性别</th>
                <th>手机号</th>
                <th>客户来源</th>
                <th>咨询课程</th>
                <th>状态</th>
                <th>跟进时间</th>
                <th>查看跟进</th>
                <th>添加报名</th>
                <th>销售</th>
                <th>班级</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>

            {% for customer in all_customer %}
                <tr>
                    <td><input type="checkbox" name="ids" value="{{ customer.pk }}"></td>
                    <td>{{ forloop.counter }}</td>
                    <td>{{ customer.qq }}</td>
                    <td>{{ customer.name|default:'暂无' }}</td>
                    <td>{{ customer.get_sex_display }}</td>
                    <td>{{ customer.phone }}</td>
                    <td>{{ customer.source }}</td>
                    <td>{{ customer.course }}</td>
                    <td>{{ customer.show_status }}</td>
                    <td>{{ customer.last_consult_date }}</td>
                    <td><a href="{% url 'one_consult_list' customer.pk %}">查看</a> </td>
                    <td><a href="{%  reverse_url request 'add_enrollment' customer_id=customer.pk %}">添加</a> </td>
                    <td>{{ customer.consultant }}</td>
                    {#                    <td>{{ customer.class_list.all }}</td>#}
                    <td>{{ customer.show_classes }}</td>
                    {#                    <td><a href="{% url 'edit_customer' customer.pk %}"> <i class="fa fa-edit"></i> </a></td>#}
                    <td><a href="{% reverse_url request 'edit_customer' customer.pk %}"> <i class="fa fa-edit"></i></a>
                    </td>
                </tr>
            {% endfor %}


            </tbody>
        </table>

    </form>

    <nav aria-label="Page navigation">
        <ul class="pagination">
            {{ page_html|safe }}
        </ul>
    </nav>

{% endblock %}